import React from 'react';
import {Layout, Modal} from 'antd';
import './index.less';
import {connect} from "dva";
import Curd from "components/Curd";
import BaseComponent from "components/Base/BaseComponent";
import {getBpDeviceType, getEcgDeviceType} from "../../../models/deviceType";

const {Content, Footer, Header} = Layout;

@connect(({bpSession}) => ({bpSession}))
export default class extends BaseComponent {

  state = {
    visible: false,
  }

  getNamespace() {
    return 'bpSession';
  }

  getTableColumns(self) {
    return [

      {
        title: '设备ID',
        name: 'numeration',
        tableItem: {},
      },

      {
        title: '血压型号',
        name: 'deviceType',
        dict: getBpDeviceType(),
        tableItem: {},
      },
      {
        title: '绑定患者',
        name: 'patientId',
        tableItem: {},
        formItem: {}
      },
      {
        title: '最后一次血压数据',
        name: 'lastBp',
        tableItem: {},
      },
      {
        title: '最后数据包时间',
        name: 'lastTime',
        tableItem: {},
      }
    ];
  }


  getSearchColumns() {
    return [{
      title: '设备id',
      name: 'deviceId',
      searchItem: {}
    }];
  }

  render() {

    const curdProps = {
      ...this.props,
      namespace: this.getNamespace(),
      tableColumns: this.getTableColumns,
      searchColumns: this.getSearchColumns,
      showBindDevices: this.showBindDevices,
      showAddDelete: false,
      pagination: true,
      align: 'center',
      selectType: 'none',
    }

    return (
      <Curd {...curdProps}/>
    );
  }

}
